femoddingfandomcom-20200214-history
User blog:MasterKnight/FE1 hacking notes
Battle calculation 3CBBD 20CFCB 204DCC : sets Fight Speed values 3CC5D (Fight Speed storage in $0338~$0339) A001 : Y = 1 B91803 : A = Speed BE2003 : X = Weapon Type 38 FD0FD7 : A -= Weapon Weight 1002 A900 : Minimization to 0 993803 : Store Fight Speed 88 10EC : Repeat for player unit 60 202FCD (3CD3F (Luck storage in $0342~$0343)) A001 B91A03 994203 88 10F7 60 20E5CB (3CBF5 (Net Hit storage in $033A~$033B)) A001 B91403 : A = Unit's Skill BE2003 : X = Unit's Weapon E008 F048 E02A B044 : Branch for magic weapons 7D6BD7 : A += Weapon Hit 8D6003 : $0360 = Hit B92003 : A = Unit's Weapon C92A B013 : Branch for tomes 2070CE B91003 : A = Enemy Terrain Boost 18 793803 : A += Enemy Fight Speed 8D5F03 : $5F03 = Enemy Evade 2070CE 4C21CC Tomes: 2070CE AD1A03 : A = Enemy Luck 8D5F03 2070CE Non-Tomes meet up here: AD6003 38 ED5F03 : A = Hit - Enemy Evade 1002 A900 : Minimize to 0 C964 : Compare Net Hit, 100 9002 A964 : Maximize to 100 Magic Weapons portion goes back here: 993A03 : $033A+Y holds unit's Net Hit 88 10AF : Branches back to beginning for checking the other player 60 Magic weapons: 2070CE BD6BD7 38 F94203 : A = Net Hit 1002 A900 : Minimization to 0 2070CE 4C32CC 20F0CC (3CD00 (DEF stat storage in $0336~$0337) A001 2070CE B92003 : A = Enemy Weapon C908 F00D C92A B009 : Magic Weapon branch 2070CE B91C03 : A = Physical DEF 4C0FCD Magic Weapon stuff: 2070CE B92603 : A = Magic DEF Both meet up here: 993E03 : $033E holds used DEF stat 88 10DD : repeat for other player 60 2064CC : sets Damage values 2016CD (3CD26 (Net Crit storage in $0340~$0341) A001 B91403 : A = Skill 18 791A03 : A += Luck 4A : A /= 2 BE2003 : X = Weapon 18 7DC7D7 : A += Weapon Crit 4A 994003 88 10EA : usual redo for P1 60 203BCD (3CD4B (Does attack connect $0344~$0345 and $0346~$0347) A001 A900 994403 994603 2070CE B91E03 : A = Enemy Range F010 2070CE BE2003 : X = Weapon Type BDC3D9 : A = Weapon Range bytes (bits for 2 and 4 used) 209BC3 (3C3AB) 4A4A4A60 B015 9045 : Branch to Return if enemy is ranged but player isn't Enemy melee returns here: 2070CE BE2003 : X = Weapon Type BDC3D9 : A = Weapon Range bytes (bits for 2 and 4 used) BE1E03 : X = Range F001 : Branch Melee Range +1 4A : LSR A 4A 4A 9032 : Branch to Return if other player doesn't have melee Both units same range: B93A03 : A = Net Hit F014 20A9CD (3CDB9) 8610 8412 48 AD7476 C907 D00D AD0503 A203 : X = 3 DDD0CD : Check for equivalence to B2, B1, B0, A5 F00A CA 10F8 68 A610 A412 18 : Reset Carry 60 68 A610 A412 38 : Set Carry 60 B00F 207ECE D93A03 F002 B005 Attack hits: A901 994403 : $0344 = 1 Come back here if Net Hit is 0 or if attack misses: B93A03 : A = Net Hit F014 20A9CD B00F 207ECE D93A03 F002 B005 A901 994603 : $0346 = 1 Come back here if Net Hit is 0 or ? or attack misses: 88 3003 : Branch to Return if done 4C3DCD : Usual redo process for P1 60 20D4CD (3CDE4) A001 A900 994B03 994D03 B94003 F01E 207ECE D94003 : Compare (RNG?), Crit F002 B005 A901 994B03 : $034B = 1 Crit failure goes here: 207ECE D94003 F002 B005 A901 994D03 : $034D = 1 Crit is 0 or does not happen: 88 10D2 : Usual repeat process for P1 AD8304 : Triangle Attack? F008 A901 8D4B03 8D4D03 60 2012CE 2062CE 60 3CBDF AD8304 F010 AD2003 <-- A = Weapon Type C908 F004 C90E D005 A900 8D8304 60 3CC74 A001 : Y = 1 B91203 : A = Strongth welling in the unit's body BE2003 : X = Weapon Type E008 : Thunder Sword Check F04F E02A : Magic Tome check B04B 7D57D6 : Add Weapon Might 8508 : ($08) = ATK BD57D6 : A = Weapon Might 994903 : ($0349/A) holds Weapon Might BDDBD8 : Weapon Effective ability check F01D : branch if none exists 20EED2 : Carry Set by Effective applying 9018 : Branch Carry Clear, +24 Skipped if Effective applies: A508 : A = base ATK 18 : Clear Carry 7D57D6 7D57D6 8508 : ($08) = effective ATK B94903 18 : Clear Carry 7D57D6 7D57D6 : A = Weapon Might x 3 994903 : ($0349+Y) = Weapon Might x 3 Both meet up back here: A508 : A = ($08) 8D6003 : ($0360) = effective ATK 2070CE : Y = EOR Y, 1 B93E03 : A = ($033E+(EOR Y,1)) (DEF stat) 8D5F03 : ($5F03) = Physical DEF DEF stat value 2070CE : Y = EOR Y, 1 AD6003 : A = effective ATK 38 : Set Carry ED5F03 : A -= Physical DEF 1018 : Branch Plus +24 A900 : A = 0 F014 : Branch Equal (effectively Always) +20 Magic comes back here: BD57D6 : A = Weapon Might 994903 : ($0349/A) holds Weapon Might 2070CE : Y = EOR Y, 1 38 : Set Carry F92603 : A -= enemy's Magic DEF 1002 : Branch Plus +2 A900 : A = 0 2070CE : Y = EOR Y, 1 Both attack types are handled: 48 : Push A AD2003 : A = Weapon Type C90A : Is Weapon Type Falchion? D004 : If No, skip next 4 bytes 68 : Pull A 4CE6CC : Jump 3CCE6 68 : Pull A C928 : Compare A, 40 9002 : Branch Carry Clear, +2 A928 : A = 40 993C03 : ($033C+Y) = A 88 : Y -= 1 3003 : Branch Minus +3 4C66CC : Redo entire process for player 60 3D2FE 8C7403 : ($0374) = Y 8E7303 : ($0373) = X 0A : ASL A AA : X = ASL A BD37D9 : A = ($D937+2A) 8500 : ($00) = ($D937+2A) BD38D9 : A = ($D938+2A) 8501 : ($01) = ($D938+2A) AE7403 : X = ($0374) 2077CE : X = EOR ($0374), 1 A000 : Y = 0 Loop: B100 : A = (Y + ($00)) C9FF : Compare A, 255 F008 : Branch A=255, +8 DD0603 : Compare A, Enemy's Class F006 : Branch A=Enemy's Class, +6 C8 : Increment Y 10F2 : Branch Plus (effectively Always), -14 Effectiveness doesn't apply: 18 9001 Effectiveness applies: 38 Both meet up here: AE7303 : X = ($0373) AC7403 : Y = ($0374) 60 : Return From Subroutine (Carry Flag set if effectiveness applies) 3CE87: 48 8A : A = X 4901 : A = EOR X, 1 AA : X = EOR X, 1 68 60 3CE80: 48 98 : A = Y 4901 : A = EOR Y, 1 A8 : Y = EOR Y, 1 68 60 3CE8E (RNG?) 204EC0 8500 A90A 8501 20C9C6 A501 8549 A500 8548 A919 854A 20EBC6 A548 C964 9002 A964 60 A919 854A 8C7203 8E7103 204EC0 8548 A900 8549 20EBC6 A548 AC7203 AE7103 60 Battle stuff 3CAC0: 2021D3 20EFCF 2037D1 20ADCB 202FCF A900 8D4803 AD0303 D07C AD0203 D017 2045CF AD3403 F05B AD3503 F059 204CCF AD3403 F04E D01F 204CCF AD3403 D00A A900 8D5503 8D5603 F03A 2045CF AD3403 F032 AD3503 F030 AD3803 : A = P1 Fight Speed CD3903 : Compare P2 Fight Speed F02E B00F P2 wins: A902 : A = 2 8D4803 : $0348 = 2 204CCF AD3403 F016 D01D P1 wins: AD5803 D018 : Must be Durability = 1 Check to skip the doubling A901 8D4803 : $0348 = 1 2045CF AD3503 F005 D009 4C3DCB 2085D0 4C3DCB Neither side doubles comes back here: 2073CB 2046CB A901 8D0103 60 3D331: ADED76 D00A A9F4 8500 A976 8501 D008 A915 8500 A977 8501 A900 8D8204 A013 A204 B100 C95B D005 A900 8D1103 C958 D003 EE8204 C8 CA D0EA 60 3CFFF: A206 : X = 6 Loop: 204ED0 : establishes pointers for ($04) and ($08) A000 : Y = 0 B104 : Load P1's stat 9108 : P1's stat stored in $0331~$032C CA : Decrement X 10F4 : repeats process for stats in order: Physical DEF, Luck, Speed, Weapon Level, Skill, Strength AD0A03 : A = P1 Old HP 8D3403 8D3603 : P1 Old HP loaded into $0334 and $0336 AD0B03 : A = P2 Old HP 8D3503 8D3703 : P2 Old HP loaded into $0335 and $0337 AD0803 8D2903 AD0E03 8D2B03 AD0F03 C964 9005 A964 8D0F03 A900 8D4F03 8D5003 8D5803 8D7704 8D8A04 ADDF05 F010 A900 8D1003 8D1103 A90E 8D2203 8D2303 60 3D05E: 8A 48 0A AA BD69D0 8504 BD6AD0 8505 : stores pointer for stat in order of stats: Strength, Skill, Weapon Level, Speed, Luck, Physical DEF, Max HP BD77D0 8508 BD78D0 8509 : stores pointer for unit's stat in order of stats: Strength, Skill, Weapon Level, Speed, Luck, Physical DEF, Max HP 68 AA 60 Hacking stuff Doubling hack 3CB17: CD3903 was changed to 2090F9 (JSR $F990) 3F9A0: (all FFs before) 18 : Clear Carry 2C0203 : Enemy Phase check, Zero Flag not yet set if P1 Fight Speed is odd number D00C : Branch Unequal +12 6901 : A += 1 2C0203 : second Enemy Phase Check for odd number P1 Fight Speed D007 : Branch Unequal +7 6908 : A += 8 4CA4F9 : JMP $F9A4 Even number P1 Fight Speed on Enemy Phase check happened: 6901 : A += 1 Everything else goes here: CD3903 : Compare A, P2 Fight Speed F013 9011 : Branch to Return if P2's Fight Speed is at +1 advantage or better (C=0, Z=0 results in P2 doubling) C90A : Compare A, 10 9007 E90A : Subtract A, 10 (net result A = P1 Fight Speed - 1 on Player Phase, - 9 on Enemy Phase) CD3903 : Compare A, P2 Fight Speed B006 : Branch to Return if P1's Fight Speed is higher than P2 Fight Speed by enough (C=1, Z=0 would result in P1 doubling) AD3903 : A = P2 Fight Speed CD3903 : Done to set of Zero Flag as need be (Z=1 results in neither unit doubling) 60 Category:Blog posts